Skip to content
This repository was archived by the owner on Sep 12, 2022. It is now read-only.

Activemodel7 couchbase ruby client#2

Draft
CedricCouton wants to merge 70 commits intomasterfrom
activemodel7-couchbase-ruby-client
Draft

Activemodel7 couchbase ruby client#2
CedricCouton wants to merge 70 commits intomasterfrom
activemodel7-couchbase-ruby-client

Conversation

@CedricCouton
Copy link
Copy Markdown
Owner

workerB

Comment thread lib/couchbase-orm/base.rb
CouchbaseOrm.logger.debug "Data - Get #{id}"
!bucket.get(id, quiet: true).nil?
CouchbaseOrm.logger.debug "Data - Exists? #{id}"
collection.exists(id).exists
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a exists? method in collection

Comment thread lib/couchbase-orm/base.rb
alias_method :has_key?, :exists?
end

class MismatchTypeError < RuntimeError; end
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surement à supprimer

def touch(**options)
CouchbaseOrm.logger.debug "Data - Touch #{@__metadata__.key}"
res = self.class.bucket.touch(@__metadata__.key, async: false, **options)
res = self.class.collection.touch(@__metadata__.key, async: false, **options)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace all **options by encapsulating them with Options

Comment thread lib/couchbase-orm/base.rb
else
false
end
records = quiet ? collection.get_multi(ids) : collection.get_multi!(ids)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should pass option to get_multi

nil
end

def get_multi!(*ids, **options)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should add a test where first id is valid but not second


# Clean up record if the id doesn't exist
self.bucket.delete(key, quiet: true)
self.collection.remove(key)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't destruct db on a finder ⚠️

@CedricCouton CedricCouton force-pushed the activemodel7-couchbase-ruby-client branch from 0fd05cc to 922dbb8 Compare September 8, 2022 20:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants